#include <string.h>

#include "lib.h"

#include "getfullh.h"
#include "opthelpr.h"

GetFullHouse::GetFullHouse(uint8* counts)
{
	this->counts = counts;

	// assumes there *is* a full house
	//
	usedJoker = 0;
	three = has_ofAKind(3);
	if (!three && HASJOKER() && HASACE() > 1)
	{
		three = counts + COUNTNDX(ACERANK);
		usedJoker = 3;
	}

	pair = has_ofAKind(2);
	if (!pair && RANKPTR(three) != ACERANK &&
		!usedJoker && HASJOKER() && HASACE() > 0)
	{
		pair = counts + COUNTNDX(ACERANK);
		usedJoker = 1;
	}

	ASSERT(three != (uint8*)0 && pair != (uint8*)0);
}

int32
GetFullHouse::getThreeRank()
{
	return RANKPTR(three);
}

int32
GetFullHouse::getPairRank()
{
	return RANKPTR(pair);
}
